<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>印章管理</title>
</head>
<body class="layui-layout-body">
    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div class="body_right">
            <h4 class="nav_title">印章管理
            		<!--
            		<a href="javascript:openwinx('添加印章','/admin/devices/form.htm','600','450');" class="add_btn">添加</a>
            		-->
            </h4>
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
		        <ul class="layui-tab-title">
		            <li class="layui-this">待分配</li>
		            <li lay-id="EFFECTIVE">已分配</li>
		            <li lay-id="DESERTED">已失效</li>
		        </ul>
		        <div class="layui-tab-content" >
            			<div class="layui-tab-item layui-show">
            			
            					
					<div class="layui-row">
				        <form class="layui-form no_bordertop" action="/admin/devices/initList.htm">
				          <div class="layui-input-inline">
				            <input type="text" name="devicesCode" value="${query.devicesCode}" placeholder="请输入设备编号" autocomplete="off" class="layui-input">
				          </div>
				          <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
				          
				          <a href="/temp/devicesTemp.csv" class="layui-btn layui-btn-normal"><i class="layui-icon">&#xe601;</i>下载模板</a>
				          <button type="button" class="layui-btn layui-btn-danger" id="upload"><i class="layui-icon"></i>选择导入</button>
				          <button type="button" class="layui-btn layui-btn-warm" id="setting"><i class="layui-icon">&#xe620;</i>批量分配</button>
				        </form>
				      </div>
			            <table class="layui-table  layui-form" mytable" lay-even="" lay-skin="nob">
			                <thead>
			                <tr>
			                    <th>选择</th>
			                    <th>编号</th>
			                    <th>型号</th>
			                    <th>出厂日期</th>
			                    <th>版本号</th>
			                    <th>支持网络</th>
			                    <th>导入时间</th>
			                    <th>操作</th>
			                </tr>
			                </thead>
			                <tbody>
			                		<#list pm.datas as item>
			                    <tr>
			                        <td><input type="checkbox" name="devicesId" value="${item.devicesId}" lay-skin="primary"></td>
			                        <td>${item.devicesCode}</td>
			                        <td>${item.model}</td>
			                        <td>
			                        		<#if item.produceDate??>
			                        		${item.produceDate?string('yyyy-MM-dd')}
			                        		<#else>
			                        			-
			                        		</#if>
			                        	</td>
			                        <td>${item.devicesVerson}</td>
			                        <td>${item.network}</td>
			                        <td>
			                        	   <#if item.createTime??>
			                        		${item.createTime?string('yyyy-MM-dd HH:mm:ss')}
			                        		<#else>
			                        			-
			                        		</#if>
			                        </td>
			                        <td class="allbox_a">
			                        		<a href="javascript:openwinx('设备详情','/admin/devices/info.htm?devicesId=${item.devicesId}',800,600);">查看</a>
			                        		<a href="javascript:xconfirm('确认是否删除','/admin/devices/delete.htm',{devicesId:'${item.devicesId}'});">删除</a>
			                        	</td>
			                    </tr>
			                    </#list>
			                </tbody>
			            </table>
			            <@p.page pm=pm></@p.page>
            			
            		    </div>
        			</div>
    			</div>
        </div>
     </div>
<script>
layui.use(['upload','element'], function(){
  	  var $ = layui.jquery ,upload = layui.upload,element = layui.element;
  
	  //普通图片上传
	  var uploadInst = upload.render({
	    elem: '#upload'
	    ,exts:'csv'
	    ,url: '/admin/devices/imports.htm'
	    ,done: function(res){
	      
	      if(res.code == 1){
	         layer.msg(res.msg);
	      }else{
	      	layer.msg(res.msg);
	      }
	     
	    }
	    ,error: function(){
	      
	    }
	  });
	  
	  
	  $("#setting").click(function(){
	  
	  		var $checked  = $("input:checkbox[name='devicesId']:checked");
	  		if($checked.length == 0){
	  			layer.msg('请选择设备');
	  		}else{
	  			openwinx('选择公司','/admin/devices/select.htm',600,400)
	  		}
	  		
	  })
	  
	  element.on('tab(docDemoTabBrief)', function(elem){
	  		var id = $(this).attr('lay-id');
	  		if(id == 'EFFECTIVE'){
	  		 	location.href='/admin/devices/effeList.htm';
	  		}
	  		
	  		if(id == 'DESERTED'){
	  			location.href='/admin/devices/deadList.htm';
	  		}
	  });
	  
  
});
</script>
</body>
</html>